package java_012_zuoye04;

public class java04 {
	public static void main(String[] args) {
		String s1 = "dajlskldjsalkdjsalkda";
		String s2 = "djaskldjlsalk";
		getMaxSubString(s2,s1);
	}
	private static String getMaxSubString(String s2, String s1) {
		String max = "";
		String min = "";
		max = (s1.length()>s2.length())?s1: s2;
		min = (max==s1)?s2: s1;
		String temp = null;
		for(int x=0; x<min.length(); x++)
		{
			for(int y=0,z=min.length()-x; z!=min.length()+1; y++,z++)
			{
				temp = min.substring(y,z);
				if(max.contains(temp)){
					System.out.println(temp);
					return temp;
				}
			}
		}
		return "";
	}

}
